/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.sapra.echo;

import nextapp.echo2.app.Alignment;
import nextapp.echo2.app.Extent;
import nextapp.echo2.app.FillImage;
import nextapp.echo2.app.ImageReference;
import nextapp.echo2.app.ResourceImageReference;

/**
 *
 * @author ppratsc
 */
public class wAviso extends nextapp.echo2.app.WindowPane {
    private  String DIR_IMAGEN="org/sapra/echo/image/";
    //private int opcion=0;
  public wAviso(String title,String msg) {
        super();
        setTitle(title);
        setTitleBackgroundImage(new FillImage(new ResourceImageReference(DIR_IMAGEN+"fondo_titulo2.png")));
        setModal(true);
        setClosable(false);
        setMovable(false);
        setHeight(new Extent(230,Extent.PX));
        setResizable(false);
        //opcion=opc;
        add(new AvisoContentPane(msg));
        
    }

    private class AvisoContentPane extends nextapp.echo2.app.ContentPane{
        
    public AvisoContentPane(String msg) {
            super();
            initComponents();

            m_LabMsg.setText(msg);

        }

        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {

            column1 = new nextapp.echo2.app.Column();//GEN-BEGIN:init_components
            m_LabMsg = new nextapp.echo2.app.Label();
            m_BtnOK = new nextapp.echo2.app.Button();
            Ltx=new nextapp.echo2.app.Label();

            if(opc1==2){
            ImageReference rf=new ResourceImageReference(dir2);
            Ltx.setIcon(rf);
            }
            //acm=new nextapp.echo2.app.Grid(2);
            row=new nextapp.echo2.app.Row();
            //acm.add(m_LabMsg);
            //acm.add(Ltx);
           //row.add(m_LabMsg);
            row.add(Ltx);
            //row.add(acm);
            row.setAlignment(Alignment.ALIGN_RIGHT);
            setBackgroundImage(new FillImage(new ResourceImageReference(DIR_IMAGEN+"fondo.jpg")));
            add(column1);

            column1.setCellSpacing(new nextapp.echo2.app.Extent(
                    20,
                    nextapp.echo2.app.Extent.PX));

            column1.setInsets(new nextapp.echo2.app.Insets(
                    new nextapp.echo2.app.Extent(10, nextapp.echo2.app.Extent.PX),
                    new nextapp.echo2.app.Extent(20, nextapp.echo2.app.Extent.PX),
                    new nextapp.echo2.app.Extent(10, nextapp.echo2.app.Extent.PX),
                    new nextapp.echo2.app.Extent(20, nextapp.echo2.app.Extent.PX)));

            column1.setLocale(new java.util.Locale(
                    "en",
                    "US"));
            column1.add(row);
            column1.add(m_LabMsg);
            column1.add(m_BtnOK);

            m_LabMsg.setFont(new nextapp.echo2.app.Font(
                    nextapp.echo2.app.Font.VERDANA,
                    nextapp.echo2.app.Font.PLAIN,
                    new nextapp.echo2.app.Extent(14, nextapp.echo2.app.Extent.PX)));

            m_LabMsg.setText("EMPTY");

            m_LabMsg.setTextAlignment(new nextapp.echo2.app.Alignment(
                    nextapp.echo2.app.Alignment.CENTER,
                    nextapp.echo2.app.Alignment.CENTER));

            m_LabMsg.setTextPosition(new nextapp.echo2.app.Alignment(
                    nextapp.echo2.app.Alignment.CENTER,
                    nextapp.echo2.app.Alignment.CENTER));

            nextapp.echo2.app.layout.ColumnLayoutData m_LabMsg_Ld =
                    new nextapp.echo2.app.layout.ColumnLayoutData();
            m_LabMsg_Ld.setAlignment(new nextapp.echo2.app.Alignment(
                    nextapp.echo2.app.Alignment.CENTER,
                    nextapp.echo2.app.Alignment.CENTER));
            m_LabMsg.setLayoutData(m_LabMsg_Ld);


            m_BtnOK.setAlignment(new nextapp.echo2.app.Alignment(
                    nextapp.echo2.app.Alignment.CENTER,
                    nextapp.echo2.app.Alignment.BOTTOM));

            m_BtnOK.setStyleName("Default");

            //m_BtnOK.setText("OK");
            ImageReference rf=new ResourceImageReference(dir2);
            m_BtnOK.setIcon(rf);
            //m_BtnOK.setBackgroundImage(new FillImage(new ResourceImageReference(DIR_IMAGEN+"boton4.png")));
            m_BtnOK.setWidth(new Extent(70));

            nextapp.echo2.app.layout.ColumnLayoutData m_BtnOK_Ld =
                    new nextapp.echo2.app.layout.ColumnLayoutData();
            m_BtnOK_Ld.setAlignment(new nextapp.echo2.app.Alignment(
                    nextapp.echo2.app.Alignment.CENTER,
                    nextapp.echo2.app.Alignment.CENTER));
            m_BtnOK.setLayoutData(m_BtnOK_Ld);

            m_BtnOK.addActionListener(new nextapp.echo2.app.event.ActionListener(){
                public void actionPerformed(nextapp.echo2.app.event.ActionEvent evt) {
                    onOK(evt);
                }
            });//GEN-END:init_components

        }// </editor-fold>


        // Action listeners//GEN-LINE:listeners_area

        private void onOK(nextapp.echo2.app.event.ActionEvent evt) {//GEN-FIRST:onOK_nextapp.echo2.app.event.ActionEvent
            wAviso win = (wAviso)getParent();
            win.userClose();
        }//GEN-LAST:onOK_nextapp.echo2.app.event.ActionEvent



        // Variables declaration - do not modify//GEN-BEGIN:variables_declaration
        private nextapp.echo2.app.Column column1;
        //private  nextapp.echo2.app.Grid acm;
        private nextapp.echo2.app.Row row;
        private nextapp.echo2.app.Label Ltx;
        private nextapp.echo2.app.Label m_LabMsg;
        private nextapp.echo2.app.Button m_BtnOK;//GEN-END:variables_declaration
        private  String dir2="org/sapra/echo/image/boton_aceptar2.png";
        private int opc1;
        

    }
}
